home *** CD-ROM | disk | FTP | other *** search
/ Game Programming in C++ - Start to Finish / GameProgrammingS.iso / developer_install / CEGUISDK-0.4.1-VC6-STLport.exe / {app} / include / CEGUISystem.h < prev    next >
C/C++ Source or Header  |  2005-10-02  |  30KB  |  1,029 lines

  1. /************************************************************************
  2.     filename:     CEGUISystem.h
  3.     created:    20/2/2004
  4.     author:        Paul D Turner
  5.  
  6.     purpose:    Defines interface for main GUI system class
  7. *************************************************************************/
  8. /*************************************************************************
  9.     Crazy Eddie's GUI System (http://www.cegui.org.uk)
  10.     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
  11.  
  12.     This library is free software; you can redistribute it and/or
  13.     modify it under the terms of the GNU Lesser General Public
  14.     License as published by the Free Software Foundation; either
  15.     version 2.1 of the License, or (at your option) any later version.
  16.  
  17.     This library is distributed in the hope that it will be useful,
  18.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  20.     Lesser General Public License for more details.
  21.  
  22.     You should have received a copy of the GNU Lesser General Public
  23.     License along with this library; if not, write to the Free Software
  24.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  25. *************************************************************************/
  26. #ifndef _CEGUISystem_h_
  27. #define _CEGUISystem_h_
  28.  
  29. #include "CEGUIBase.h"
  30. #include "CEGUIString.h"
  31. #include "CEGUISingleton.h"
  32. #include "CEGUIRenderer.h"
  33. #include "CEGUIMouseCursor.h"
  34. #include "CEGUIInputEvent.h"
  35. #include "CEGUIResourceProvider.h"
  36.  
  37.  
  38. #if defined(_MSC_VER)
  39. #    pragma warning(push)
  40. #    pragma warning(disable : 4275)
  41. #    pragma warning(disable : 4251)
  42. #endif
  43.  
  44.  
  45. // Start of CEGUI namespace section
  46. namespace CEGUI
  47. {
  48. //! Implementation struct that tracks and controls multiclick for mouse buttons.
  49. struct MouseClickTrackerImpl;
  50.  
  51.  
  52. /*!
  53. \brief
  54.     The System class is the CEGUI class that provides access to all other elements in this system.
  55.  
  56.     This object must be created by the client application.  The System object requires that you pass it
  57.     an initialised Renderer object which it can use to interface to whatever rendering system will be
  58.     used to display the GUI imagery.
  59. */
  60. class CEGUIEXPORT System : public Singleton<System>, public EventSet
  61. {
  62. public:
  63.     static const String EventNamespace;                //!< Namespace for global events
  64.  
  65.     /*************************************************************************
  66.         Constants
  67.     *************************************************************************/
  68.     static const double        DefaultSingleClickTimeout;        //!< Default timeout for generation of single click events.
  69.     static const double        DefaultMultiClickTimeout;        //!< Default timeout for generation of multi-click events.
  70.     static const Size        DefaultMultiClickAreaSize;        //!< Default allowable mouse movement for multi-click event generation.
  71.  
  72.     // event names
  73.     static const String EventGUISheetChanged;                //!< Name of event fired whenever the GUI sheet is changed.
  74.     static const String EventSingleClickTimeoutChanged;    //!< Name of event fired when the single-click timeout is changed.
  75.     static const String EventMultiClickTimeoutChanged;    //!< Name of event fired when the multi-click timeout is changed.
  76.     static const String EventMultiClickAreaSizeChanged;    //!< Name of event fired when the size of the multi-click tolerance area is changed.
  77.     static const String EventDefaultFontChanged;            //!< Name of event fired when the default font changes.
  78.     static const String EventDefaultMouseCursorChanged;    //!< Name of event fired when the default mouse cursor changes.
  79.     static const String EventMouseMoveScalingChanged;        //!< Name of event fired when the mouse move scaling factor changes.
  80.  
  81.  
  82.     /*************************************************************************
  83.         Construction and Destruction
  84.     *************************************************************************/
  85.     /*!
  86.     \brief
  87.         Constructs a System object.
  88.  
  89.     \param renderer
  90.         Pointer to the valid Renderer object that will be used to render GUI imagery
  91.  
  92.     \param logFile
  93.         pointer to a utf8 encoded buffer containing the name to use for the log file.
  94.     */
  95.     System(Renderer* renderer, const utf8* logFile = (const utf8*)"CEGUI.log");
  96.  
  97.     /*!
  98.     \brief
  99.         Construct a new System object
  100.  
  101.     \param renderer
  102.         Pointer to the valid Renderer object that will be used to render GUI imagery
  103.  
  104.     \param resourceProvider
  105.         Pointer to a ResourceProvider object.
  106.  
  107.     \param logFile
  108.         pointer to a utf8 encoded buffer containing the name to use for the log file.
  109.     */
  110.     System(Renderer* renderer, ResourceProvider* resourceProvider, const utf8* logFile = (const utf8*)"CEGUI.log");
  111.  
  112.  
  113.     /*!
  114.     \brief
  115.         Construct a new System object
  116.  
  117.     \param renderer
  118.         Pointer to the valid Renderer object that will be used to render GUI imagery
  119.  
  120.     \param scriptModule
  121.         Pointer to a ScriptModule object.  may be NULL.
  122.  
  123.     \param configFile
  124.         pointer to a utf8 encoded buffer containing the name to use for the configuration file.
  125.     */
  126.     System(Renderer* renderer, ScriptModule* scriptModule, const utf8* configFile = (const utf8*)"cegui.config");
  127.  
  128.  
  129.     /*!
  130.     \brief
  131.         Construct a new System object
  132.  
  133.     \param renderer
  134.         Pointer to the valid Renderer object that will be used to render GUI imagery
  135.  
  136.     \param scriptModule
  137.         Pointer to a ScriptModule object.  may be NULL.
  138.  
  139.     \param resourceProvider
  140.         Pointer to a ResourceProvider object.
  141.  
  142.     \param configFile
  143.         pointer to a utf8 encoded buffer containing the name to use for the configuration file.
  144.     */
  145.     System(Renderer* renderer, ScriptModule* scriptModule, ResourceProvider* resourceProvider, const utf8* configFile = (const utf8*)"cegui.config");
  146.  
  147.  
  148.     /*!
  149.     \brief
  150.         Constructs a System object.
  151.  
  152.     \param renderer
  153.         Pointer to the valid Renderer object that will be used to render GUI imagery
  154.  
  155.     \param xmlParser
  156.         Pointer to a valid XMLParser object to be used when parsing XML files, or NULL to use a default parser.
  157.  
  158.     \param logFile
  159.         pointer to a utf8 encoded buffer containing the name to use for the log file.
  160.     */
  161.     System(Renderer* renderer, XMLParser* xmlParser, const utf8* logFile = (const utf8*)"CEGUI.log");
  162.  
  163.     
  164.     /*!
  165.     \brief
  166.         Constructs a System object.
  167.  
  168.     \param renderer
  169.         Pointer to the valid Renderer object that will be used to render GUI imagery
  170.  
  171.     \param resourceProvider
  172.         Pointer to a ResourceProvider object.
  173.     
  174.     \param xmlParser
  175.         Pointer to a valid XMLParser object to be used when parsing XML files, or NULL to use a default parser.
  176.  
  177.     \param logFile
  178.         pointer to a utf8 encoded buffer containing the name to use for the log file.
  179.     */
  180.     System(Renderer* renderer, ResourceProvider* resourceProvider, XMLParser* xmlParser, const utf8* logFile = (const utf8*)"CEGUI.log");
  181.  
  182.     
  183.     /*!
  184.     \brief
  185.         Construct a new System object
  186.  
  187.     \param renderer
  188.         Pointer to the valid Renderer object that will be used to render GUI imagery
  189.  
  190.     \param xmlParser
  191.         Pointer to a valid XMLParser object to be used when parsing XML files, or NULL to use a default parser.
  192.     
  193.     \param scriptModule
  194.         Pointer to a ScriptModule object.  may be NULL.
  195.  
  196.     \param configFile
  197.         pointer to a utf8 encoded buffer containing the name to use for the configuration file.
  198.     */
  199.     System(Renderer* renderer, XMLParser* xmlParser, ScriptModule* scriptModule, const utf8* configFile = (const utf8*)"cegui.config");
  200.  
  201.         
  202.     /*!
  203.     \brief
  204.         Construct a new System object
  205.  
  206.     \param renderer
  207.         Pointer to the valid Renderer object that will be used to render GUI imagery
  208.  
  209.     \param resourceProvider
  210.         Pointer to a ResourceProvider object.
  211.     
  212.     \param xmlParser
  213.         Pointer to a valid XMLParser object to be used when parsing XML files, or NULL to use a default parser.
  214.     
  215.     \param scriptModule
  216.         Pointer to a ScriptModule object.  may be NULL.
  217.  
  218.     \param configFile
  219.         pointer to a utf8 encoded buffer containing the name to use for the configuration file.
  220.     */
  221.     System(Renderer* renderer, ResourceProvider* resourceProvider, XMLParser* xmlParser, ScriptModule* scriptModule, const utf8* configFile = (const utf8*)"cegui.config");
  222.  
  223.  
  224.     /*!
  225.     \brief
  226.         Destructor for System objects.
  227.     */
  228.     ~System(void);
  229.  
  230.  
  231.     /*!
  232.     \brief
  233.         Return a pointer to the Renderer object being used by the system
  234.  
  235.     \return
  236.         Pointer to the Renderer object used by the system.
  237.     */
  238.     Renderer*    getRenderer(void) const            {return d_renderer;}
  239.  
  240.  
  241.     /*!
  242.     \brief
  243.         Return singleton System object
  244.  
  245.     \return
  246.         Singleton System object
  247.     */
  248.     static    System&    getSingleton(void);
  249.  
  250.  
  251.     /*!
  252.     \brief
  253.         Return pointer to singleton System object
  254.  
  255.     \return
  256.         Pointer to singleton System object
  257.     */
  258.     static    System*    getSingletonPtr(void);
  259.  
  260.  
  261.     /*!
  262.     \brief
  263.         Set the default font to be used by the system
  264.  
  265.     \param name
  266.         String object containing the name of the font to be used as the system default.
  267.  
  268.     \return
  269.         Nothing.
  270.     */
  271.     void    setDefaultFont(const String& name);
  272.  
  273.  
  274.     /*!
  275.     \brief
  276.         Set the default font to be used by the system
  277.  
  278.     \param font
  279.         Pointer to the font to be used as the system default.
  280.  
  281.     \return
  282.         Nothing.
  283.     */
  284.     void    setDefaultFont(Font* font);
  285.  
  286.  
  287.     /*!
  288.     \brief
  289.         Return a pointer to the default Font for the GUI system
  290.  
  291.     \return
  292.         Pointer to a Font object that is the default font in the system.
  293.     */
  294.     Font*    getDefaultFont(void) const                {return d_defaultFont;}
  295.  
  296.  
  297.     /*!
  298.     \brief
  299.         Causes a full re-draw next time renderGUI() is called
  300.  
  301.     \return
  302.         Nothing
  303.     */
  304.     void    signalRedraw()        {d_gui_redraw = true;}
  305.  
  306.  
  307.     /*!
  308.     \brief
  309.         Return a boolean value to indicate whether a full re-draw is requested next time renderGUI() is called.
  310.  
  311.     \return
  312.         true if a re-draw has been requested
  313.     */
  314.     bool    isRedrawRequested() const        {return d_gui_redraw;}
  315.  
  316.  
  317.     /*!
  318.     \brief
  319.         Render the GUI
  320.  
  321.         Depending upon the internal state, this may either re-use rendering from last time, or trigger a full re-draw from all elements.
  322.  
  323.     \return
  324.         Nothing
  325.     */
  326.     void    renderGUI(void);
  327.  
  328.  
  329.     /*!
  330.     \brief
  331.         Set the active GUI sheet (root) window.
  332.  
  333.     \param sheet
  334.         Pointer to a Window object that will become the new GUI 'root'
  335.  
  336.     \return
  337.         Pointer to the window that was previously set as the GUI root.
  338.     */
  339.     Window*    setGUISheet(Window* sheet);
  340.  
  341.  
  342.     /*!
  343.     \brief
  344.         Return a pointer to the active GUI sheet (root) window.
  345.  
  346.     \return
  347.         Pointer to the window object that has been set as the GUI root element.
  348.     */
  349.     Window*    getGUISheet(void) const        {return d_activeSheet;}
  350.  
  351.  
  352.     /*!
  353.     \brief
  354.         Return the current timeout for generation of single-click events.
  355.  
  356.         A single-click is defined here as a button being pressed and then released.
  357.  
  358.     \return
  359.         double value equal to the current single-click timeout value.
  360.     */
  361.     double    getSingleClickTimeout(void) const        {return d_click_timeout;}
  362.  
  363.  
  364.     /*!
  365.     \brief
  366.         Return the current timeout for generation of multi-click events.
  367.  
  368.         A multi-click event is a double-click, or a triple-click.  The value returned
  369.         here is the maximum allowable time between mouse button down events for which
  370.         a multi-click event will be generated.
  371.  
  372.     \return
  373.         double value equal to the current multi-click timeout value.
  374.     */
  375.     double    getMultiClickTimeout(void) const        {return d_dblclick_timeout;}
  376.  
  377.  
  378.     /*!
  379.     \brief
  380.         Return the size of the allowable mouse movement tolerance used when generating multi-click events.
  381.  
  382.         This size defines an area with the mouse at the centre.  The mouse must stay within the tolerance defined
  383.         for a multi-click (double click, or triple click) event to be generated.
  384.  
  385.     \return
  386.         Size object describing the current multi-click tolerance area size.
  387.     */
  388.     const Size&    getMultiClickToleranceAreaSize(void) const        {return d_dblclick_size;}
  389.  
  390.  
  391.     /*!
  392.     \brief
  393.         Set the timeout used for generation of single-click events.
  394.  
  395.         A single-click is defined here as a button being pressed and then released.
  396.  
  397.     \param timeout
  398.         double value equal to the single-click timeout value to be used from now onwards.
  399.  
  400.     \return
  401.         Nothing.
  402.     */
  403.     void    setSingleClickTimeout(double timeout);
  404.  
  405.  
  406.     /*!
  407.     \brief
  408.         Set the timeout to be used for the generation of multi-click events.
  409.  
  410.         A multi-click event is a double-click, or a triple-click.  The value returned
  411.         here is the maximum allowable time between mouse button down events for which
  412.         a multi-click event will be generated.
  413.  
  414.     \param timeout
  415.         double value equal to the multi-click timeout value to be used from now onwards.
  416.  
  417.     \return
  418.         Nothing.
  419.     */
  420.     void setMultiClickTimeout(double timeout);
  421.  
  422.  
  423.     /*!
  424.     \brief
  425.         Set the size of the allowable mouse movement tolerance used when generating multi-click events.
  426.  
  427.         This size defines an area with the mouse at the centre.  The mouse must stay within the tolerance defined
  428.         for a multi-click (double click, or triple click) event to be generated.
  429.  
  430.     \param sz
  431.         Size object describing the multi-click tolerance area size to be used.
  432.  
  433.     \return
  434.         Nothing.
  435.     */
  436.     void setMultiClickToleranceAreaSize(const Size&    sz);
  437.  
  438.  
  439.     /*!
  440.     \brief
  441.         Return the currently set default mouse cursor image
  442.  
  443.     \return
  444.         Pointer to the current default image used for the mouse cursor.  May return NULL if default cursor has not been set,
  445.         or has intentionally been set to NULL - which results in a blank default cursor.
  446.     */
  447.     const Image*    getDefaultMouseCursor(void) const    {return d_defaultMouseCursor;}
  448.  
  449.  
  450.     /*!
  451.     \brief
  452.         Set the image to be used as the default mouse cursor.
  453.  
  454.     \param image
  455.         Pointer to an image object that is to be used as the default mouse cursor.  To have no cursor rendered by default, you
  456.         can specify NULL here.
  457.  
  458.     \return
  459.         Nothing.
  460.     */
  461.     void    setDefaultMouseCursor(const Image* image);
  462.  
  463.  
  464.     /*!
  465.     \brief
  466.         Set the image to be used as the default mouse cursor.
  467.  
  468.     \param image
  469.         One of the MouseCursorImage enumerated values.
  470.  
  471.     \return
  472.         Nothing.
  473.     */
  474.     void    setDefaultMouseCursor(MouseCursorImage image)        {setDefaultMouseCursor((const Image*)image);}
  475.  
  476.  
  477.     /*!
  478.     \brief
  479.         Set the image to be used as the default mouse cursor.
  480.  
  481.     \param imageset
  482.         String object that contains the name of the Imageset  that contains the image to be used.
  483.  
  484.     \param image_name
  485.         String object that contains the name of the Image on \a imageset that is to be used.
  486.  
  487.     \return
  488.         Nothing.
  489.  
  490.     \exception UnknownObjectException    thrown if \a imageset is not known, or if \a imageset contains no Image named \a image_name.
  491.     */
  492.     void    setDefaultMouseCursor(const String& imageset, const String& image_name);
  493.  
  494.  
  495.     /*!
  496.     \brief
  497.         Return the Window object that the mouse is presently within
  498.  
  499.     \return
  500.         Pointer to the Window object that currently contains the mouse cursor, or NULL if none.
  501.     */
  502.     Window*    getWindowContainingMouse(void) const    {return d_wndWithMouse;}
  503.  
  504.  
  505.     /*!
  506.     \brief
  507.         Return a pointer to the ScriptModule being used for scripting within the GUI system.
  508.  
  509.     \return
  510.         Pointer to a ScriptModule based object.
  511.     */
  512.     ScriptModule*    getScriptingModule(void) const;
  513.  
  514.     /*!
  515.     \brief
  516.         Return a pointer to the ResourceProvider being used within the GUI system.
  517.  
  518.     \return
  519.         Pointer to a ResourceProvider based object.
  520.     */
  521.     ResourceProvider* getResourceProvider(void) const;
  522.  
  523.     /*!
  524.     \brief
  525.         Execute a script file if possible.
  526.  
  527.     \param filename
  528.         String object holding the filename of the script file that is to be executed
  529.         
  530.     \param resourceGroup
  531.         Resource group identifier to be passed to the ResourceProvider when loading the script file.
  532.     */
  533.     void    executeScriptFile(const String& filename, const String& resourceGroup = "") const;
  534.  
  535.  
  536.     /*!
  537.     \brief
  538.         Execute a scripted global function if possible.  The function should not take any parameters and should return an integer.
  539.  
  540.     \param function_name
  541.         String object holding the name of the function, in the global script environment, that
  542.         is to be executed.
  543.  
  544.     \return
  545.         The integer value returned from the script function.
  546.     */
  547.     int        executeScriptGlobal(const String& function_name) const;
  548.  
  549.  
  550.     /*!
  551.     \brief
  552.         If possible, execute script code contained in the given CEGUI::String object.
  553.  
  554.     \param str
  555.         String object holding the valid script code that should be executed.
  556.  
  557.     \return
  558.         Nothing.
  559.     */
  560.     void executeScriptString(const String& str) const;
  561.  
  562.  
  563.     /*!
  564.     \brief
  565.         return the current mouse movement scaling factor.
  566.  
  567.     \return
  568.         float value that is equal to the currently set mouse movement scaling factor.  Defaults to 1.0f.
  569.     */
  570.     float    getMouseMoveScaling(void) const;
  571.  
  572.  
  573.     /*!
  574.     \brief
  575.         Set the current mouse movement scaling factor
  576.  
  577.     \param scaling
  578.         float value specifying the scaling to be applied to mouse movement inputs.
  579.  
  580.     \return
  581.         nothing.
  582.     */
  583.     void    setMouseMoveScaling(float scaling);
  584.  
  585.  
  586.     /*!
  587.     \brief
  588.         Internal method used to inform the System object whenever a window is destroyed, so that System can perform any required
  589.         housekeeping.
  590.  
  591.     \note
  592.         This method is not intended for client code usage.  If you use this method anything can, and probably will, go wrong!
  593.     */
  594.     void    notifyWindowDestroyed(const Window* window);
  595.  
  596.  
  597.     /*!
  598.     \brief
  599.         Return the current system keys value.
  600.  
  601.     \return
  602.         uint value representing a combination of the SystemKey bits.
  603.     */
  604.     uint    getSystemKeys(void) const   { return d_sysKeys; }
  605.  
  606.     /*!
  607.     \brief
  608.         Return the XMLParser object.
  609.      */
  610.     XMLParser* getXMLParser(void) const     { return d_xmlParser; }
  611.  
  612.  
  613.     /*!
  614.     \brief
  615.         Set the system default Tooltip object.  This value may be NULL to indicate that no default Tooltip will be
  616.         available.
  617.  
  618.     \param tooltip
  619.         Pointer to a valid Tooltip based object which should be used as the default tooltip for the system, or NULL to
  620.         indicate that no system default tooltip is required.  Note that when passing a pointer to a Tooltip object,
  621.         ownership of the Tooltip does not pass to System.
  622.  
  623.     \return
  624.         Nothing.
  625.     */
  626.     void setTooltip(Tooltip* tooltip);
  627.  
  628.     /*!
  629.     \brief
  630.         Set the system default Tooltip to be used by specifying a Window type.
  631.  
  632.         System will internally attempt to create an instance of the specified window type (which must be
  633.         derived from the base Tooltip class).  If the Tooltip creation fails, the error is logged and no
  634.         system default Tooltip will be available.
  635.  
  636.     \param tooltipType
  637.         String object holding the name of the Tooltip based Window type which should be used as the Tooltip for
  638.         the system default.
  639.  
  640.     \return
  641.         Nothing.
  642.     */
  643.     void setTooltip(const String& tooltipType);
  644.  
  645.     /*!
  646.     \brief
  647.         return a poiter to the system default tooltip.  May return 0.
  648.  
  649.     \return
  650.         Pointer to the current system default tooltip.  May return 0 if
  651.         no system default tooltip is available.
  652.      */
  653.     Tooltip* getDefaultTooltip(void) const  { return d_defaultTooltip; }
  654.  
  655.  
  656.     /*!
  657.     \brief
  658.         Internal method to directly set the current modal target.
  659.  
  660.     \note
  661.         This method is called internally by Window, and must be used by client code.
  662.         Doing so will most likely not have the expected results.
  663.     */
  664.     void setModalTarget(Window* target)        {d_modalTarget = target;}
  665.  
  666.     /*!
  667.     \brief
  668.         Return a pointer to the Window that is currently the modal target.
  669.  
  670.     \return
  671.         Pointer to the current modal target. NULL if there is no modal target.
  672.     */
  673.     Window* getModalTarget(void) const        {return d_modalTarget;}
  674.  
  675.  
  676.     /*************************************************************************
  677.         Input injection interface
  678.     *************************************************************************/
  679.     /*!
  680.     \brief
  681.         Method that injects a mouse movement event into the system
  682.  
  683.     \param delta_x
  684.         amount the mouse moved on the x axis.
  685.  
  686.     \param delta_y
  687.         amount the mouse moved on the y axis.
  688.  
  689.     \return
  690.         - true if the input was processed by the gui system.
  691.         - false if the input was not processed by the gui system.
  692.     */
  693.     bool    injectMouseMove(float delta_x, float delta_y);
  694.  
  695.  
  696.     /*!
  697.     \brief
  698.         Method that injects that the mouse has left the application window
  699.  
  700.     \return
  701.         - true if the generated mouse move event was handled.
  702.         - false if the generated mouse move event was not handled.
  703.     */
  704.     bool    injectMouseLeaves(void);
  705.  
  706.  
  707.     /*!
  708.     \brief
  709.         Method that injects a mouse button down event into the system.
  710.  
  711.     \param button
  712.         One of the MouseButton values indicating which button was pressed.
  713.  
  714.     \return
  715.         - true if the input was processed by the gui system.
  716.         - false if the input was not processed by the gui system.
  717.     */
  718.     bool    injectMouseButtonDown(MouseButton button);
  719.  
  720.  
  721.     /*!
  722.     \brief
  723.         Method that injects a mouse button up event into the system.
  724.  
  725.     \param button
  726.         One of the MouseButton values indicating which button was released.
  727.  
  728.     \return
  729.         - true if the input was processed by the gui system.
  730.         - false if the input was not processed by the gui system.
  731.     */
  732.     bool    injectMouseButtonUp(MouseButton button);
  733.  
  734.  
  735.     /*!
  736.     \brief
  737.         Method that injects a key down event into the system.
  738.  
  739.     \param key_code
  740.         uint value indicating which key was pressed.
  741.  
  742.     \return
  743.         - true if the input was processed by the gui system.
  744.         - false if the input was not processed by the gui system.
  745.     */
  746.     bool    injectKeyDown(uint key_code);
  747.  
  748.  
  749.     /*!
  750.     \brief
  751.         Method that injects a key up event into the system.
  752.  
  753.     \param key_code
  754.         uint value indicating which key was released.
  755.  
  756.     \return
  757.         - true if the input was processed by the gui system.
  758.         - false if the input was not processed by the gui system.
  759.     */
  760.     bool    injectKeyUp(uint key_code);
  761.  
  762.  
  763.     /*!
  764.     \brief
  765.         Method that injects a typed character event into the system.
  766.  
  767.     \param code_point
  768.         Unicode code point of the character that was typed.
  769.  
  770.     \return
  771.         - true if the input was processed by the gui system.
  772.         - false if the input was not processed by the gui system.
  773.     */
  774.     bool    injectChar(utf32 code_point);
  775.  
  776.  
  777.     /*!
  778.     \brief
  779.         Method that injects a mouse-wheel / scroll-wheel event into the system.
  780.  
  781.     \param delta
  782.         float value representing the amount the wheel moved.
  783.  
  784.     \return
  785.         - true if the input was processed by the gui system.
  786.         - false if the input was not processed by the gui system.
  787.     */
  788.     bool    injectMouseWheelChange(float delta);
  789.  
  790.  
  791.     /*!
  792.     \brief
  793.         Method that injects a new position for the mouse cursor.
  794.  
  795.     \param x_pos
  796.         New absolute pixel position of the mouse cursor on the x axis.
  797.  
  798.     \param y_pos
  799.         New absolute pixel position of the mouse cursoe in the y axis.
  800.  
  801.     \return
  802.         - true if the generated mouse move event was handled.
  803.         - false if the generated mouse move event was not handled.
  804.     */
  805.     bool    injectMousePosition(float x_pos, float y_pos);
  806.  
  807.  
  808.     /*!
  809.     \brief
  810.         Method to inject time pulses into the system.
  811.  
  812.     \param timeElapsed
  813.         float value indicating the amount of time passed, in seconds, since the last time this method was called.
  814.  
  815.     \return
  816.         Currently, this method always returns true.
  817.     */
  818.     bool    injectTimePulse(float timeElapsed);
  819.  
  820.  
  821. private:
  822.     // unimplemented constructors / assignment
  823.     System(const System& obj);
  824.     System& operator=(const System& obj);
  825.  
  826.     /*************************************************************************
  827.         Implementation Constants
  828.     *************************************************************************/
  829.     static const char    CEGUIConfigSchemaName[];            //!< Filename of the XML schema used for validating Config files.
  830.  
  831.  
  832.     /*************************************************************************
  833.         Implementation Functions
  834.     *************************************************************************/
  835.     /*!
  836.     \brief
  837.         Given Point \a pt, return a pointer to the Window that should receive a mouse input if \a pt is the mouse location.
  838.  
  839.     \param pt
  840.         Point object describing a screen location in pixels.
  841.  
  842.     \return
  843.         Pointer to a Window object that should receive mouse input with the system in its current state and the mouse at location \a pt.
  844.     */
  845.     Window*    getTargetWindow(const Point& pt) const;
  846.  
  847.  
  848.     /*!
  849.     \brief
  850.         Return a pointer to the Window that should receive keyboard input considering the current modal target.
  851.  
  852.     \return
  853.         Pointer to a Window object that should receive the keyboard input.
  854.     */
  855.     Window* getKeyboardTargetWindow(void) const;
  856.  
  857.  
  858.     /*!
  859.     \brief
  860.         Return a pointer to the next window that is to receive the input if the given Window did not use it.
  861.  
  862.     \param w
  863.         Pointer to the Window that just received the input.
  864.  
  865.     \return
  866.         Pointer to the next window to receive the input.
  867.     */
  868.     Window* getNextTargetWindow(Window* w) const;
  869.  
  870.  
  871.     /*!
  872.     \brief
  873.         Translate a MouseButton value into the corresponding SystemKey value
  874.  
  875.     \param btn
  876.         MouseButton value describing the value to be converted
  877.  
  878.     \return
  879.         SystemKey value that corresponds to the same button as \a btn
  880.     */
  881.     SystemKey    mouseButtonToSyskey(MouseButton btn) const;
  882.  
  883.  
  884.     /*!
  885.     \brief
  886.         Translate a Key::Scan value into the corresponding SystemKey value.
  887.  
  888.         This takes key direction into account, since we map two keys onto one value.
  889.  
  890.     \param key
  891.         Key::Scan value describing the value to be converted
  892.  
  893.     \param direction
  894.         true if the key is being pressed, false if the key is being released.
  895.  
  896.     \return
  897.         SystemKey value that corresponds to the same key as \a key, or 0 if key was not a system key.
  898.     */
  899.     SystemKey    keyCodeToSyskey(Key::Scan key, bool direction);
  900.  
  901.  
  902.     /*!
  903.     \brief
  904.         Method to do the work of the constructor
  905.     */
  906.        void    constructor_impl(Renderer* renderer, ResourceProvider* resourceProvider, XMLParser* xmlParser, ScriptModule* scriptModule, const String& configFile, const String& logFile);
  907.  
  908.  
  909.     /*!
  910.     \brief
  911.         add events for the System object
  912.     */
  913.     void    addSystemEvents(void);
  914.  
  915.  
  916.     /*!
  917.     \brief
  918.         Handler method for display size change notifications
  919.     */
  920.     bool    handleDisplaySizeChange(const EventArgs& e);
  921.  
  922.  
  923.     /*************************************************************************
  924.         Handlers for System events
  925.     *************************************************************************/
  926.     /*!
  927.     \brief
  928.         Handler called when the main system GUI Sheet (or root window) is changed.
  929.  
  930.         \a e is a WindowEventArgs with 'window' set to the old root window.
  931.     */
  932.     void    onGUISheetChanged(WindowEventArgs& e);
  933.  
  934.  
  935.     /*!
  936.     \brief
  937.         Handler called when the single-click timeout value is changed.
  938.     */
  939.     void    onSingleClickTimeoutChanged(EventArgs& e);
  940.  
  941.  
  942.     /*!
  943.     \brief
  944.         Handler called when the multi-click timeout value is changed.
  945.     */
  946.     void    onMultiClickTimeoutChanged(EventArgs& e);
  947.  
  948.  
  949.     /*!
  950.     \brief
  951.         Handler called when the size of the multi-click tolerance area is changed.
  952.     */
  953.     void    onMultiClickAreaSizeChanged(EventArgs& e);
  954.  
  955.  
  956.     /*!
  957.     \brief
  958.         Handler called when the default system font is changed.
  959.     */
  960.     void    onDefaultFontChanged(EventArgs& e);
  961.  
  962.  
  963.     /*!
  964.     \brief
  965.         Handler called when the default system mouse cursor image is changed.
  966.     */
  967.     void    onDefaultMouseCursorChanged(EventArgs& e);
  968.  
  969.  
  970.     /*!
  971.     \brief
  972.         Handler called when the mouse movement scaling factor is changed.
  973.     */
  974.     void    onMouseMoveScalingChanged(EventArgs& e);
  975.  
  976.  
  977.     /*************************************************************************
  978.         Implementation Data
  979.     *************************************************************************/
  980.     Renderer*    d_renderer;            //!< Holds the pointer to the Renderer object given to us in the constructor
  981.     ResourceProvider* d_resourceProvider;      //!< Holds the pointer to the ResourceProvider object given to us by the renderer or the System constructor.
  982.     Font*        d_defaultFont;        //!< Holds a pointer to the default GUI font.
  983.     bool        d_gui_redraw;        //!< True if GUI should be re-drawn, false if render should re-use last times queue.
  984.  
  985.     Window*        d_wndWithMouse;        //!< Pointer to the window that currently contains the mouse.
  986.     Window*        d_activeSheet;        //!< The active GUI sheet (root window)
  987.     Window*        d_modalTarget;        //!< Pointer to the window that is the current modal target. NULL is there is no modal target.
  988.  
  989.     String d_strVersion;    //!< CEGUI version
  990.  
  991.     uint        d_sysKeys;            //!< Current set of system keys pressed (in mk1 these were passed in, here we track these ourself).
  992.     bool        d_lshift;            //!< Tracks state of left shift.
  993.     bool        d_rshift;            //!< Tracks state of right shift.
  994.     bool        d_lctrl;            //!< Tracks state of left control.
  995.     bool        d_rctrl;            //!< Tracks state of right control.
  996.     bool        d_lalt;                //!< Tracks state of left alt.
  997.     bool        d_ralt;                //!< Tracks state of right alt.
  998.  
  999.     double        d_click_timeout;    //!< Timeout value, in seconds, used to generate a single-click (button down then up)
  1000.     double        d_dblclick_timeout;    //!< Timeout value, in seconds, used to generate multi-click events (botton down, then up, then down, and so on).
  1001.     Size        d_dblclick_size;    //!< Size of area the mouse can move and still make multi-clicks.
  1002.  
  1003.     MouseClickTrackerImpl* const    d_clickTrackerPimpl;        //!< Tracks mouse button click generation.
  1004.  
  1005.     // mouse cursor related
  1006.     const Image*    d_defaultMouseCursor;        //!< Image to be used as the default mouse cursor.
  1007.  
  1008.     // scripting
  1009.     ScriptModule*    d_scriptModule;            //!< Points to the scripting support module.
  1010.     String            d_termScriptName;        //!< Name of the script to run upon system shutdown.
  1011.  
  1012.     float    d_mouseScalingFactor;            //!< Scaling applied to mouse movement inputs.
  1013.  
  1014.     XMLParser*  d_xmlParser;        //!< XMLParser object we use to process xml files.
  1015.     bool        d_ourXmlParser;     //!< true when we created the xml parser.
  1016.  
  1017.     Tooltip* d_defaultTooltip;      //!< System default tooltip object.
  1018.     bool     d_weOwnTooltip;        //!< true if System created the custom Tooltip.
  1019. };
  1020.  
  1021. } // End of  CEGUI namespace section
  1022.  
  1023.  
  1024. #if defined(_MSC_VER)
  1025. #    pragma warning(pop)
  1026. #endif
  1027.  
  1028. #endif    // end of guard _CEGUISystem_h_
  1029.